
module.exports = function ($scope, $resource, $modalInstance, info, subsidyInfo) {

    $scope.groupInfo = info;
    if(info.group_num >= 3){
        $scope.groupInfo.type_name = '两日及多日游';
        if(subsidyInfo.subsidy_more){
            str2Data(subsidyInfo.subsidy_more);
        }
        
    } else {
        $scope.groupInfo.type_name = '一日游';
        if(subsidyInfo.subsidy_one){
            str2Data(subsidyInfo.subsidy_one);
        }
    }
    $scope.groupInfo.domestic_money = info.domestic_num * (info.money1 || 0);
    $scope.groupInfo.foreigner_money = info.foreigner_num * (info.money2 || 0);

    //将补贴规则转换为数值
    function str2Data(rule) {
        var index = rule.indexOf('+');
        if(index != -1){
            var a = rule.substring(0, index);
            info['money' + a.substring(0, 1)] = a.substring(2);
            a = rule.substring(index + 1);
            info['money' + a.substring(0, 1)] = a.substring(2);
        } else {
            info['money' + rule.substring(0, 1)] = rule.substring(2);
        }
    }

    $scope.close = function () {
        $modalInstance.dismiss('cancel');
    }

};